library(tidyverse)
library(rgdal)
#devtools::install_github("dkahle/ggmap")
library(ggmap)
library(ggsn)

Preprocessing

Import SWSN data.

swsn <- read_csv('Data/attributes_orig.csv')
swsn
## # A tibble: 514 × 16
##    SWSN_ID         SWSN_Site     Macro     Micro  GKPM GKPMPZ Periods
##      <dbl>             <chr>     <chr>     <chr> <dbl>  <dbl>   <dbl>
## 1        2  Swingle's Sample San Pedro San Pedro     0      1       3
## 2        3       Bajada Site San Pedro San Pedro     0      0       3
## 3        5             Buzan San Pedro San Pedro     1      1       2
## 4        7       Ash Terrace San Pedro San Pedro     1      1       4
## 5        8        Lost Mound San Pedro San Pedro     1      1       3
## 6        9 Dudleyville Mound San Pedro San Pedro     0      0       3
## 7       10         Leaverton San Pedro San Pedro     1      1       3
## 8       11      Camp Village San Pedro San Pedro     1      1       3
## 9       12         High Mesa San Pedro San Pedro     1      1       3
## 10      13      Elliott Site San Pedro San Pedro     0      1       2
## # ... with 504 more rows, and 9 more variables: EASTING <int>,
## #   NORTHING <int>, P1room <dbl>, P2room <dbl>, P3room <dbl>,
## #   P4room <dbl>, P5room <dbl>, P6room <dbl>, N0S1 <int>

Pull the coordinates from the attribute map, reproject from UTM to Lat Lon.

swsn.pts <- read_csv('Data/attributes_orig.csv') %>% 
  select(easting = EASTING, northing = NORTHING) %>%
  SpatialPoints(proj4string=CRS("+proj=utm +zone=12 +datum=WGS84")) %>%
  spTransform(CRS("+proj=longlat +datum=WGS84")) %>% 
  coordinates %>%
  data.frame

Download Stamen terrain basemap.

bbox <- c(left = -113.5, right = -106.5, bottom = 31, top = 37.5)

terrain <- get_map(location = bbox,
  color = "color",
  source = "stamen",
  maptype = "terrain")

terrain.background <- get_map(location = bbox,
  color = "color",
  source = "stamen",
  maptype = "terrain-background")

terrain.labels <- get_map(location = bbox,
  color = "color",
  source = "stamen",
  maptype = "terrain-labels")

terrain.lines <- get_map(location = bbox,
  color = "color",
  source = "stamen",
  maptype = "terrain-lines")

toner <- get_map(location = bbox,
  color = "color",
  source = "stamen",
  maptype = "toner")

toner.2010 <- get_map(location = bbox,
  color = "color",
  source = "stamen",
  maptype = "toner-2010")

toner.2011 <- get_map(location = bbox,
  color = "color",
  source = "stamen",
  maptype = "toner-2011")

toner.background <- get_map(location = bbox,
  color = "color",
  source = "stamen",
  maptype = "toner-background")

toner.hybrid <- get_map(location = bbox,
  color = "color",
  source = "stamen",
  maptype = "toner-hybrid")

toner.labels <- get_map(location = bbox,
  color = "color",
  source = "stamen",
  maptype = "toner-labels")

toner.lines <- get_map(location = bbox,
  color = "color",
  source = "stamen",
  maptype = "toner-lines")

toner.lite <- get_map(location = bbox,
  color = "color",
  source = "stamen",
  maptype = "toner-lite")

watercolor <- get_map(location = bbox,
  color = "color",
  source = "stamen",
  maptype = "watercolor")

Plotting

ggmap(terrain) +
  geom_point(aes(x = easting, y = northing), size = 2, data = swsn.pts) +
  labs(x = "Longitude", y = "Latitude")

ggmap(terrain.background) +
  geom_point(aes(x = easting, y = northing), size = 2, data = swsn.pts) +
  labs(x = "Longitude", y = "Latitude")

ggmap(terrain.labels) +
  geom_point(aes(x = easting, y = northing), size = 2, data = swsn.pts) +
  labs(x = "Longitude", y = "Latitude")

ggmap(terrain.lines) +
  geom_point(aes(x = easting, y = northing), size = 2, data = swsn.pts) +
  labs(x = "Longitude", y = "Latitude")

ggmap(toner) +
  geom_point(aes(x = easting, y = northing), size = 2, data = swsn.pts) +
  labs(x = "Longitude", y = "Latitude")

ggmap(toner.2010) +
  geom_point(aes(x = easting, y = northing), size = 2, data = swsn.pts) +
  labs(x = "Longitude", y = "Latitude")

ggmap(toner.2011) +
  geom_point(aes(x = easting, y = northing), size = 2, data = swsn.pts) +
  labs(x = "Longitude", y = "Latitude")

ggmap(toner.background) +
  geom_point(aes(x = easting, y = northing), size = 2, data = swsn.pts) +
  labs(x = "Longitude", y = "Latitude")

ggmap(toner.hybrid) +
  geom_point(aes(x = easting, y = northing), size = 2, data = swsn.pts) +
  labs(x = "Longitude", y = "Latitude")

ggmap(toner.labels) +
  geom_point(aes(x = easting, y = northing), size = 2, data = swsn.pts) +
  labs(x = "Longitude", y = "Latitude")

ggmap(toner.lines) +
  geom_point(aes(x = easting, y = northing), size = 2, data = swsn.pts) +
  labs(x = "Longitude", y = "Latitude")

ggmap(toner.lite) +
  geom_point(aes(x = easting, y = northing), size = 2, data = swsn.pts) +
  labs(x = "Longitude", y = "Latitude")

ggmap(watercolor) +
  geom_point(aes(x = easting, y = northing), size = 2, data = swsn.pts) +
  labs(x = "Longitude", y = "Latitude")